package com.lwc.util;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by liwancheng on 2017/5/21.
 */
public class PropUtil {

    private static Properties properties = new Properties();

    static {
        try {
            properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getString(String key){
        return String.valueOf(properties.get(key));
    }

    public static int getInt(String key) {
        return Integer.valueOf(String.valueOf(properties.get(key)));
    }

    public static void main(String[] args) {
        System.out.println(PropUtil.getString("name"));
        System.out.println(PropUtil.getInt("age"));
    }
}
